package com.atstudying.mall.mallauthserver;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

/**
 * springsession的核心原理：
 * 1）@EnableRedisHttpSession导入RedisHttpSessionConfiguration配置
 * sessionRepository==》RedisHttpSessionConfiguration给容器中添加了一个组件：RedisIndexedSessionRepository：==》redis操作session，session的增删改查封装类
 *
 * 2：RedisHttpSessionConfiguration 继承了SpringHttpSessionConfiguration这里面有一个
 * SessionRepositoryFilter组件==》filiter：session存储过滤器：每个请求过来都必须经过filiter
 *    1：创建的时候，就自动从容器中获取到了sessionRepository
 *    2：SessionRepositoryFilter类里面调用了doFilterInternal方法==》原始的request,response都被这个方法包装成了SessionRepositoryRequestWrapper  SessionRepositoryResponseWrapper
 *    3：以后获取session。request.getSession
 *    4：wrappedRequest.getSession()===>SessionRespository中获取到
 *
 *    装饰者模式
 * 自动延期，redis中的数据也是有过期时间的
 *
 *
 */
@EnableFeignClients
@EnableRedisHttpSession //整合redis作为session存储
@EnableDiscoveryClient
@SpringBootApplication
public class MallAuthServerApplication {

	public static void main(String[] args) {
		SpringApplication.run(MallAuthServerApplication.class, args);
	}

}
